/*
 * SonarQube
 * Copyright (C) 2009-2017 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
@import (reference) "../variables";
@import (reference) "../mixins";

@popupArrowSize: 8px;

.bubble-popup {
  position: absolute;
  z-index: @bubble-popup-z-index;
  margin-top: -16px;
  margin-left: @popupArrowSize;
  padding: 10px;
  border: 1px solid @barBorderColor;
  border-radius: 3px;
  box-sizing: border-box;
  background-color: @white;
  box-shadow: @defaultShadow;
  cursor: default;
}

.bubble-popup-menu {
  padding: 0;
}

.bubble-popup-arrow,
.bubble-popup-arrow:after {
  position: absolute;
  display: block;
  width: 0;
  height: 0;
  border: @popupArrowSize solid transparent;
}

.bubble-popup-arrow {
  top: 15px;
  left: -@popupArrowSize;
  border-left-width: 0;
  border-right-color: @barBorderColor;

  &:after {
    content: " ";
    left: 1px;
    bottom: -@popupArrowSize;
    border-left-width: 0;
    border-right-color: @white;
  }
}

.bubble-popup-bottom {
  margin-top: @popupArrowSize;
  margin-left: -16px;

  .bubble-popup-arrow {
    top: -@popupArrowSize;
    left: 15px;
    border-left-width: @popupArrowSize;
    border-top-width: 0;
    border-right-color: transparent;
    border-bottom-color: @barBorderColor;

    &:after {
      left: -@popupArrowSize;
      bottom: -@popupArrowSize - 1px;
      border-left-width: @popupArrowSize;
      border-top-width: 0;
      border-right-color: transparent;
      border-bottom-color: @white;
    }
  }
}

.bubble-popup-bottom-right {
  .bubble-popup-bottom;
  margin-left: 0;
  margin-right: -8px;

  .bubble-popup-arrow {
    left: auto;
    right: 15px;
  }
}

.bubble-popup-container {
  max-width: 560px;
  max-height: 300px;
  padding-right: 30px;
  overflow: auto;
}

.bubble-popup-helper {
  position: relative;

  &:focus {
    outline: none;
  }
}

.bubble-popup-helper-inline {
  display: inline-block;
}

.bubble-popup-title {
  margin-bottom: 5px;
  font-weight: 600;
}

.bubble-popup-section {
  width: 450px;
  padding-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  &.fluid {
    width: auto;
    max-width: 450px;
  }
}

.bubble-popup-section + .bubble-popup-section,
.bubble-popup-section + .bubble-popup-title {
  margin-top: 10px;
}

.bubble-popup-list {
  margin-top: 5px;

  & > li { padding: 2px 0; }
}
